perm filename PART.LSP[QLA,LSP] blob
sn#843344 filedate 1987-07-20 generic text, type C, neo UTF8
COMMENT ā VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002
C00003 ENDMK
Cā;
(defun partition (a m n d)
(declare (type-reduce integer fixnum))
(let ((i m) (j n))
(tagbody
down
(let ((k (do ((q j (1- q)))
((= i q) (return-from partition q))
(when (< (aref a q) d) (return q)))))
(setf (aref a i) (aref a k))
(incf i)
(setq j k))
up
(let ((k (do ((q i (1+ q)))
((= j q) (return-from partition q))
(when (> (aref a q) d) (return q)))))
(setf (aref a j) (aref a k))
(decf j)
(setq i k)
(go down)))))